﻿<UserControl 
	x:Class="StockTraderRI.Modules.Position.Orders.OrdersView"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:cal="http://www.codeplex.com/CompositeWPF"
	xmlns:inf="clr-namespace:StockTraderRI.Infrastructure;assembly=StockTraderRI.Infrastructure"
	xmlns:behaviors="clr-namespace:StockTraderRI.Infrastructure.Behaviors;assembly=StockTraderRI.Infrastructure"
	xmlns:a="http://schemas.galador.net/xaml/libraries">
	<UserControl.Resources>
		<Style x:Key="ShellThemeListBoxStyle" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="0,0,0,10"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>
	<Grid x:Name="LayoutRoot" Background="{x:Null}" Margin="10">
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>
		<ScrollViewer VerticalAlignment="Top" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Top" BorderThickness="0,0,0,0" Grid.RowSpan="1" Grid.Row="0">
			<ListBox x:Name="OrdersListBox" BorderThickness="0" 
					 ItemContainerStyle="{StaticResource ShellThemeListBoxStyle}" 
					 IsSynchronizedWithCurrentItem="True" 
					 ItemsSource="{Binding OrderItems}" Background="#00000000" >
				<ListBox.ItemTemplate>
					<DataTemplate>
						<a:DataControl Data="{Binding}"/>
					</DataTemplate>
				</ListBox.ItemTemplate>
			</ListBox>
		</ScrollViewer>
		<StackPanel Height="Auto" VerticalAlignment="Bottom" Orientation="Horizontal" Grid.RowSpan="1" HorizontalAlignment="Center" Grid.Row="1" Margin="5">
			<Button Name="SubmitAllButton" Command="{Binding SubmitAllCommand}" Template="{StaticResource SubmitButtonTemplate}" Cursor="Hand" Height="25">Submit All</Button>
			<Button Name="CancelAllButton" Command="{Binding CancelAllCommand}" Template="{StaticResource CancelButtonTemplate}" Cursor="Hand" Height="25">Cancel All</Button>
		</StackPanel>
	</Grid>
</UserControl>
